package aryn.mapEditor;

import java.awt.image.BufferedImage;

import aryn.framework.graphic.Load;
import aryn.framework.graphic.Transform;

public class Loader {
	
	private static final Loader INSTANCE = new Loader();
	private BufferedImage menuImg;
	private BufferedImage boardImg;
	
	private Loader() {
		this.load();
	}
	
	public void load() {
		menuImg = Load.bufferedImage("examples\\mapEditor\\menuBackground.png");
		boardImg = Load.bufferedImage("examples\\mapEditor\\boardBackground.png");
	}

	public BufferedImage[][] loadTileset(String path) {
		BufferedImage[][] tileset = new BufferedImage[8][8];
		BufferedImage set = Load.bufferedImage(path);
		for(int i = 0; i < 8; i++)
			for(int j = 0; j < 8; j++)
				tileset[i][j] = Transform.crop(set, 32*i, 32*j, 32*(i+1), 32*(j+1));
		return tileset;
	}
	
	public static Loader getInstance() {
		return INSTANCE;
	}

	public BufferedImage getMenuImg() {
		return menuImg;
	}

	public BufferedImage getBoardImg() {
		return boardImg;
	}
}
